package cn.iocoder.yudao.module.member.alliance.controller.admin;

import cn.iocoder.yudao.framework.business.audit.controller.AuditController;
import cn.iocoder.yudao.framework.business.audit.pojo.form.AuditSaveDTO;
import cn.iocoder.yudao.framework.business.basic.controller.DetailController;
import cn.iocoder.yudao.framework.business.basic.controller.PageController;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.api.member.alliance.vo.CloudAllianceApplyVO;
import cn.iocoder.yudao.module.member.alliance.service.CloudAllianceApplyService;
import cn.iocoder.yudao.module.member.alliance.vo.CloudAllianceApplyQueryDTO;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 云盟商申请")
@RestController
@RequestMapping("/member/cloud-alliance-apply")
@Validated
public class CloudAllianceApplyController implements DetailController<CloudAllianceApplyVO, Long>, PageController<CloudAllianceApplyVO, CloudAllianceApplyQueryDTO>, AuditController {

    @Resource
    private CloudAllianceApplyService cloudAllianceApplyService;

    @PreAuthorize("@ss.hasAnyRoles('super_admin', 'platform_admin', 'tenant_admin')")
    @Override
    public CommonResult<Boolean> updateAudit(AuditSaveDTO reqVO) {
        cloudAllianceApplyService.updateAudit(reqVO);
        return success(true);
    }

    @PreAuthorize("@ss.hasAnyRoles('super_admin', 'platform_admin', 'tenant_admin')")
    @Override
    public CommonResult<CloudAllianceApplyVO> getDetail(Long id) {
        return success(cloudAllianceApplyService.getDetail(id));
    }

    @PreAuthorize("@ss.hasAnyRoles('super_admin', 'platform_admin', 'tenant_admin')")
    @Override
    public CommonResult<PageResult<CloudAllianceApplyVO>> getPage(Integer pageNo, Integer pageSize, CloudAllianceApplyQueryDTO param) {
        return success(cloudAllianceApplyService.getPage(pageNo, pageSize, param));
    }

}
